{extend name="layout/layout" /}

{block name="pagecss"}
<link href="__STATIC__/plugins/bootstrap-switch/css/bootstrap-switch.min.css" rel="stylesheet" type="text/css" />
<link href="__STATIC__/admin/pages/css/printer.css" rel="stylesheet" type="text/css" />
{/block}

{block name="content"}
<div class="row">
    <div class="col-xs-12">
        <div class="box box-success">
            <div class="box-header with-border">
                <h3 class="box-title">小票机设置</h3>
                <div class="box-tools">
                    <!--<button class="btn bg-navy btn-sm" data-toggle="tooltip" title="" data-original-title="Back" onclick="history.go(-1);">
                        <i class="fa fa-reply"></i> 返回
                    </button>-->
                </div>
            </div>
            <div class="box-body">
                <form id="modal_new_role" class="form-horizontal form validation-form" method="post" enctype="multipart/form-data">
                    {empty name="id"}
                    <div class="form-body">
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>选择小票机:
                            </label>
                            <div class="col-lg-4">
                                <select class="form-control" name="type">
                                    <option value="1">飞鹅FP-58WGC(58mm)</option>
                                    <option value="2">飞鹅FP-80WGC(80mm)</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>小票机名称:
                            </label>
                            <div class="col-lg-4">
                                <input type="text" class="form-control" name="name" maxlength="20">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>小票机编号:
                            </label>
                            <div class="col-lg-4">
                                <input type="text" class="form-control" name="code" maxlength="20" placeholder="SN">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>小票机密钥:
                            </label>
                            <div class="col-lg-4">
                                <input type="text" class="form-control" name="secretKey" maxlength="20" placeholder="key">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>适用门店:
                            </label>
                            <div class="col-lg-4">
                                {if condition="$admin.roleType == 2 "}  <!-- 店员登录 -->
                                <input type="hidden" name="storeId" value="{$admin.storeId}">
                                <select  name="storeId" class="form-control" disabled>
                                {volist name="store" id="vo"}
                                    <option value="{$vo.id}" {eq name="vo.id" value="$admin.storeId"}selected{/eq}  ><span>{$vo.name}</span></option>
                                    {/volist}
                                </select>
                                {else /}
                                <select  name="storeId" class="form-control" >
                                    {volist name="store" id="vo"}
                                    <option value="{$vo.id}"  ><span>{$vo.name}</span></option>
                                    {/volist}
                                </select>
                                {/if}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">是否开启:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="isopen" name="switch" checked="checked" class="bootstrap-switch-success" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">对账单:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="switch1" name="switch" checked="checked" class="bootstrap-switch-success" />
                                    <p class="form-control-static">　顾客点单后所生成的单据</p>
                                </div>
                                <div class="relative margin-bottom">
                                    <label class="form-control-static">打印数量　</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum1" value="1" checked />1份</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum1" value="2" />2份</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">出品单:
                            </label>
                            <div class="col-md-8">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="switch2" name="switch" checked="checked" class="bootstrap-switch-success" />
                                    <p class="form-control-static">　商家所收到的顾客点单生成单据</p>
                                </div>
                                <div class="relative margin-bottom">
                                    <label class="form-control-static">打印数量　</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum2" value="1" checked />1份</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum2" value="2" />2份</label>
                                </div>
                                <div class="relative margin-bottom">
                                    <label class="form-control-static">打印方式　</label>
                                    <label class="radio-inline"><input type="radio" name="printerMethod" value="1" checked />全部商品一单</label>
                                    <label class="radio-inline"><input type="radio" name="printerMethod" value="2" />一个商品一单</label>
                                    <label class="radio-inline"><input type="radio" name="printerMethod" value="3" />分类打印</label>
                                </div>
                                <div class="sort" style="margin-left: 75px;">


                                    <div class="relative sortList">
                                        <!--<ul>-->
                                        <!--<li>类目名称1　<span class="close"></span></li>-->
                                        <!--<li>类目名称2　<span class="close"></span></li>-->
                                        <!--<li>类目名称3　<span class="close"></span></li>-->
                                        <!--<li>类目名称4　<span class="close"></span></li>-->
                                        <!--<li>类目名称5　<span class="close"></span></li>-->
                                        <!--<li>类目名称6　<span class="close"></span></li>-->
                                        <!--<li>类目名称7　<span class="close"></span></li>-->
                                        <!--</ul>-->
                                        {volist name='cate' id='vo'}
                                        <input type="checkbox" name="category" value="{$vo.id}">{$vo.name}
                                        {/volist}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">结账单:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="switch3" name="switch" checked="checked" class="bootstrap-switch-success" />
                                    <p class="form-control-static">　结帐后所生成的单据</p>
                                </div>
                                <div class="relative margin-bottom">
                                    <label class="form-control-static">打印数量　</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum3" value="1" checked />1份</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum3" value="2" />2份</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">达达配送单:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="peisong_isopen" name="switch" class="bootstrap-switch-success" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">自动打印小票:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="isauto" name="switch" checked="checked" class="bootstrap-switch-success" />
                                </div>
                            </div>
                        </div>

                        <input type="hidden" name="id" value="{$id}">
                        <hr />
                        {else /}

                        <div class="form-group">
                            <div class="col-md-5">
                                <span class="help-block text-center"></span><input type="hidden" name="id" value="{$id}">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>选择小票机:
                            </label>
                            <div class="col-lg-4">
                                <select class="form-control" name="type">
                                    <option value="1" {if condition="$printer['type']==1"}selected{/if}>飞鹅FP-58WGC(58mm)</option>
                                    <option value="2" {if condition="$printer['type']==2"}selected{/if}>飞鹅FP-80WGC(80mm)</option>
                                </select>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>小票机名称:
                            </label>
                            <div class="col-lg-4">
                                <input type="text" class="form-control" name="name" value="{php}if(isset($printer['name'])) echo $printer['name'] {/php}" maxlength="20">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>小票机编号:
                            </label>
                            <div class="col-lg-4">
                                <input type="text" class="form-control" name="code" maxlength="20" value="{php}if(isset($printer['code'])) echo $printer['code'] {/php}" placeholder="SN">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>小票机密钥:
                            </label>
                            <div class="col-lg-4">
                                <input type="text" class="form-control" name="secretKey" maxlength="20" value="{php}if(isset($printer['secretKey'])) echo $printer['secretKey'] {/php}" placeholder="key">
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label"> <span class="required"> * </span>适用门店:
                            </label>
                            <div class="col-lg-4">
                                {if condition="$admin.roleType == 2 "}  <!-- 店员登录 -->
                                <input type="hidden" name="storeId" value="{$admin.storeId}">
                                <select  name="storeId" class="form-control" disabled>
                                {volist name="store" id="vo"}
                                    <option value="{$vo.id}" {eq name="vo.id" value="$admin.storeId"}selected{/eq}  ><span>{$vo.name}</span></option>
                                    {/volist}
                                </select>
                                {else /}
                                <select  name="storeId" class="form-control" >
                                    {volist name="store" id="vo"}
                                    <option value="{$vo.id}" {present name="$printer['storeId']"}{if condition="$printer['storeId']==$vo.id"}selected{/if}{/present} ><span>{$vo.name}</span></option>
                                    {/volist}
                                </select>
                                {/if}
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">是否开启:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="isopen" name="switch" {if condition="$printer['status']==10"}checked="checked"{/if} class="bootstrap-switch-success" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">对账单:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="switch1" name="switch" {php}if(isset($printerconfig['duizhang']['status']) && $printerconfig['duizhang']['status']==10)echo "checked='checked'"{/php}  class="bootstrap-switch-success" />
                                    <p class="form-control-static">　顾客点单后所生成的单据</p>
                                </div>
                                <div class="relative margin-bottom">
                                    <label class="form-control-static">打印数量　</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum1" value="1" {php}if(isset($printerconfig['duizhang']['number']) && $printerconfig['duizhang']['number']==1)echo 'checked'{/php} />1份</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum1" value="2" {php}if(isset($printerconfig['duizhang']['number']) && $printerconfig['duizhang']['number']==2)echo 'checked'{/php} />2份</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">出品单:
                            </label>
                            <div class="col-md-8">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="switch2" name="switch" {php}if(isset($printerconfig['chuping']['status']) && $printerconfig['chuping']['status']==10)echo "checked='checked'"{/php} class="bootstrap-switch-success" />
                                    <p class="form-control-static">　商家所收到的顾客点单生成单据</p>
                                </div>
                                <div class="relative margin-bottom">
                                    <label class="form-control-static">打印数量　</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum2" value="1" {php}if(isset($printerconfig['chuping']['number']) && $printerconfig['chuping']['number']==1)echo 'checked'{/php} />1份</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum2" value="2" {php}if(isset($printerconfig['chuping']['number']) && $printerconfig['chuping']['number']==2)echo 'checked'{/php} />2份</label>
                                </div>
                                <div class="relative margin-bottom">
                                    <label class="form-control-static">打印方式　</label>
                                    <label class="radio-inline"><input type="radio" name="printerMethod" value="1" {php}if(isset($printerconfig['chuping']['mode']) && $printerconfig['chuping']['mode']=='全部商品一单')echo 'checked'{/php} />全部商品一单</label>
                                    <label class="radio-inline"><input type="radio" name="printerMethod" value="2" {php}if(isset($printerconfig['chuping']['mode']) && $printerconfig['chuping']['mode']=='一个商品一单')echo 'checked'{/php} />一个商品一单</label>
                                    <label class="radio-inline"><input type="radio" name="printerMethod" value="3" {php}if(isset($printerconfig['chuping']['mode']) && $printerconfig['chuping']['mode']=='分类打印')echo 'checked'{/php} />分类打印</label>
                                </div>
                                <div class="sort" style="margin-left: 75px;">


                                    <div class="relative sortList">
                                        <!--<ul>-->
                                        <!--<li>类目名称1　<span class="close"></span></li>-->
                                        <!--<li>类目名称2　<span class="close"></span></li>-->
                                        <!--<li>类目名称3　<span class="close"></span></li>-->
                                        <!--<li>类目名称4　<span class="close"></span></li>-->
                                        <!--<li>类目名称5　<span class="close"></span></li>-->
                                        <!--<li>类目名称6　<span class="close"></span></li>-->
                                        <!--<li>类目名称7　<span class="close"></span></li>-->
                                        <!--</ul>-->
                                        {volist name='cate' id='vo'}
                                        <input type="checkbox" name="category" {present name="$printerconfig['chuping']['type']"}{in name="$vo.id" value="$printerconfig['chuping']['type']" }checked='checked'{/in}{/present} value="{$vo.id}">{$vo.name}
                                        {/volist}
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">结账单:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="switch3" name="switch" {php}if(isset($printerconfig['jiezhang']['status']) && $printerconfig['jiezhang']['status']==10)echo "checked='checked'"{/php} class="bootstrap-switch-success" />
                                    <p class="form-control-static">　结帐后所生成的单据</p>
                                </div>
                                <div class="relative margin-bottom">
                                    <label class="form-control-static">打印数量　</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum3" value="1" {php}if(isset($printerconfig['jiezhang']['number']) && $printerconfig['jiezhang']['number']==1)echo 'checked'{/php} />1份</label>
                                    <label class="radio-inline"><input type="radio" name="printerNum3" value="2" {php}if(isset($printerconfig['jiezhang']['number']) && $printerconfig['jiezhang']['number']==2)echo 'checked'{/php} />2份</label>
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">达达配送单:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="peisong_isopen" name="switch" {if condition="$printer['peisong_status']==1"}checked="checked"{/if} class="bootstrap-switch-success" />
                                </div>
                            </div>
                        </div>
                        <div class="form-group">
                            <label class="col-lg-2 control-label">自动打印小票:
                            </label>
                            <div class="col-md-6">
                                <div class="relative margin-bottom switch" data-on="danger" data-off="warning">
                                    <input type="checkbox" id="isauto" name="switch" {if condition="$printer['isauto']==1"}checked="checked"{/if} class="bootstrap-switch-success" />
                                </div>
                            </div>
                        </div>

                        {/empty}
                        <div class="form-actions">
                            <div class="row">
                                <div class="col-md-12">
                                    <div class="form-group">
                                        <label class="col-md-3 control-label"></label>
                                        <div class="col-md-9">
                                            <button type="button" class="btn btn-primary" id="save">
                                                保存 <i class="fa fa-floppy-o"></i>
                                            </button>
                                            <button type="button" class="btn btn-default" onclick="history.go(-1);">
                                                返回 <i class="fa fa-mail-forward"></i>
                                            </button>
                                            <div class="help-block " style="color:red"></div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}

{block name="pagescript"}
<script>
    var index_url = "{:url('admin/printer/index')}";   //获取列表
    var list_url = "{:url('admin/printer/indexApi')}";   //获取小票机列表
    var add_url = "{:url('admin/printer/add')}";  //添加
    var savePost_url = "{:url('admin/printer/edit')}"
</script>
<script src="__STATIC__/admin/js/include.js" type="text/javascript"></script>
<script src="__STATIC__/plugins/bootstrap-switch/js/bootstrap-switch.min.js" type="text/javascript"></script>
<script src="__STATIC__/admin/pages/js/printer.js?v={:time()}" type="text/javascript"></script>
{/block}